<?php
/**
 * correction du pager pour Bootstrap3
 */

Yii::import('zii.widgets.grid.CGridView');

class Bs3GridView extends CGridView
{

	public $afterAjaxUpdate = "function(id, data){hackPager();}";
	public $pagerCssClass = "pagerhack";
	public $pager=array(
							'header'=>"",
							'pageSize'=>40,
							'firstPageLabel' => '<span class="glyphicon glyphicon-fast-backward"></span>',
							'prevPageLabel'  => '<span class="glyphicon glyphicon-backward"></span>',
							'nextPageLabel'  => '<span class="glyphicon glyphicon-forward"></span>',
							'lastPageLabel'  => '<span class="glyphicon glyphicon-fast-forward"></span>',
							'firstPageCssClass' => '',
							'previousPageCssClass'  => '',
							'nextPageCssClass'  => '',
							'lastPageCssClass'  => '',
						);
	public $template = "{summary}{pager}\n{items}\n{pager}";
	public $itemsCssClass = 'table table-hover table-condensed';

	 public function registerClientScript()
    {
        $cs=Yii::app()->clientScript;
        $cs->registerScript('bs3pager', "
			function hackPager() {
				$('ul.yiiPager').addClass('pagination pagination-sm pull-right').removeClass('yiiPager').parent().removeClass('pager').addClass('pagerhack');
				$('li.selected').addClass('active');
				$('ul.pagination > li.hidden').addClass('disabled').removeClass('hidden');
			}
			hackPager();
		" ,CClientScript::POS_READY);
		parent::registerClientScript();
    }
	
	
	
}
?>